﻿using System;

namespace enyo
{
    /// <summary>
    /// An item that can be swiped to show an inline confirmation prompt with confirm and cancel buttons.
    /// It is typically used to support swipe-to-delete in lists.
    /// </summary>
    public class SwipeableItem : Item
    {
        /// <summary>
        /// Set to false to prevent swiping.
        /// </summary>
        public bool Swipeable { get; set; }

        /// <summary>
        /// If false, no confirm prompt is displayed, and swipes immediately trigger an onConfirm event.
        /// </summary>
        public bool ConfirmRequired { get; set; }

        /// <summary>
        /// Caption shown for the confirm button in the confirm prompt.
        /// </summary>
        public string ConfirmCaption { get; set; }

        /// <summary>
        /// Caption shown for the cancel button in the confirm prompt.
        /// </summary>
        public string CancelCaption { get; set; }

        public bool ConfirmShowing { get; set; }

        /// <summary>
        /// If the confirm prompt is automatically hidden--for example, in a list context when a confirm prompt is shown for another row--automatically send an onConfirm event.
        /// </summary>
        public bool ConfirmWhenAutoHidden { get; set; }

        /// <summary>
        /// Allows the item to be swiped to the left.
        /// </summary>
        public bool AllowLeft { get; set; }


        /// <summary>
        /// Event fired when the user clicks the confirm button or, if confirmRequired is false, when the item is swiped.
        /// The event includes the index of the swiped item.
        /// </summary>
        //TODO:control/index
        public EnyoEvent<Control, int> onConfirm;

        /// <summary>
        /// Event fired when the user clicks the cancel button in the confirm prompt.
        /// The event includes the index of the swiped item.
        /// </summary>
        //TODO:control/index
        public EnyoEvent<Control, int> onCancel;

        /// <summary>
        /// Event fired when the user swipes the item. The event includes the index of the swiped item.
        /// </summary>
        //TODO:control/index
        public EnyoEvent<Control, int> onSwipe;

        /// <summary>
        /// Event fired when the confirm prompt is shown or hidden.
        /// </summary>
        public EnyoEvent<Control> onConfirmShowingChanged;

        /// <summary>
        /// Event fired repeatedly as the item is dragged. Includes the total x pixel delta from at-rest position.
        /// </summary>
        //TODO:control/int(in px)
        public EnyoEvent<Control, int> onDrag;
    }
}
